3 * Generates a list of changes using an Enhanced system (uses javascript).
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
23 class EnhancedChangesList
extends ChangesList
{
26 * @var RCCacheEntryFactory
28 protected $cacheEntryFactory;
31 * @var array Array of array of RCCacheEntry
38 protected $templateParser;
41 * @param IContextSource|Skin $obj
42 * @param array $filterGroups Array of ChangesListFilterGroup objects (currently optional)
45 public function __construct( $obj, array $filterGroups = [] ) {
46 if ( $obj instanceof Skin
) {
47 // @todo: deprecate constructing with Skin
48 $context = $obj->getContext();
50 if ( !$obj instanceof IContextSource
) {
51 throw new MWException( 'EnhancedChangesList must be constructed with a '
52 . 'context source or skin.' );
58 parent
::__construct( $context, $filterGroups );
60 // message is set by the parent ChangesList class
61 $this->cacheEntryFactory
= new RCCacheEntryFactory(
66 $this->templateParser
= new TemplateParser();
70 * Add the JavaScript file for enhanced changeslist
73 public function beginRecentChangesList() {
75 $this->rcMoveIndex
= 0;
76 $this->rcCacheIndex
= 0;
78 $this->rclistOpen
= false;
79 $this->getOutput()->addModuleStyles( [
81 'mediawiki.interface.helpers.styles',
82 'mediawiki.special.changeslist',
83 'mediawiki.special.changeslist.enhanced',
85 $this->getOutput()->addModules( [
86 'jquery.makeCollapsible',
89 return '<div class="mw-changeslist">';
93 * Format a line for enhanced recentchange (aka with javascript and block of lines).
95 * @param RecentChange &$rc
96 * @param bool $watched
97 * @param int|null $linenumber (default null)
101 public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) {
102 $date = $this->getLanguage()->userDate(
103 $rc->mAttribs
['rc_timestamp'],
106 if ( $this->lastdate
=== '' ) {
107 $this->lastdate
= $date;
112 # If it's a new day, flush the cache and update $this->lastdate
113 if ( $date !== $this->lastdate
) {
114 # Process current cache (uses $this->lastdate to generate a heading)
115 $ret = $this->recentChangesBlock();
116 $this->rc_cache
= [];
117 $this->lastdate
= $date;
120 $cacheEntry = $this->cacheEntryFactory
->newFromRecentChange( $rc, $watched );
121 $this->addCacheEntry( $cacheEntry );
127 * Put accumulated information into the cache, for later display.
128 * Page moves go on their own line.
130 * @param RCCacheEntry $cacheEntry
132 protected function addCacheEntry( RCCacheEntry
$cacheEntry ) {
133 $cacheGroupingKey = $this->makeCacheGroupingKey( $cacheEntry );
135 if ( !isset( $this->rc_cache
[$cacheGroupingKey] ) ) {
136 $this->rc_cache
[$cacheGroupingKey] = [];
139 array_push( $this->rc_cache
[$cacheGroupingKey], $cacheEntry );
143 * @todo use rc_source to group, if set; fallback to rc_type
145 * @param RCCacheEntry $cacheEntry
149 protected function makeCacheGroupingKey( RCCacheEntry
$cacheEntry ) {
150 $title = $cacheEntry->getTitle();
151 $cacheGroupingKey = $title->getPrefixedDBkey();
153 $type = $cacheEntry->mAttribs
['rc_type'];
155 if ( $type == RC_LOG
) {
157 $cacheGroupingKey = SpecialPage
::getTitleFor(
159 $cacheEntry->mAttribs
['rc_log_type']
160 )->getPrefixedDBkey();
163 return $cacheGroupingKey;
168 * @param RCCacheEntry[] $block
170 * @throws DomainException
172 protected function recentChangesBlockGroup( $block ) {
173 $recentChangesFlags = $this->getConfig()->get( 'RecentChangesFlags' );
175 # Add the namespace and title of the block as part of the class
176 $tableClasses = [ 'mw-collapsible', 'mw-collapsed', 'mw-enhanced-rc', 'mw-changeslist-line' ];
177 if ( $block[0]->mAttribs
['rc_log_type'] ) {
179 $tableClasses[] = 'mw-changeslist-log';
180 $tableClasses[] = Sanitizer
::escapeClass( 'mw-changeslist-log-'
181 . $block[0]->mAttribs
['rc_log_type'] );
183 $tableClasses[] = 'mw-changeslist-edit';
184 $tableClasses[] = Sanitizer
::escapeClass( 'mw-changeslist-ns'
185 . $block[0]->mAttribs
['rc_namespace'] . '-' . $block[0]->mAttribs
['rc_title'] );
187 if ( $block[0]->watched
188 && $block[0]->mAttribs
['rc_timestamp'] >= $block[0]->watched
190 $tableClasses[] = 'mw-changeslist-line-watched';
192 $tableClasses[] = 'mw-changeslist-line-not-watched';
195 # Collate list of users
199 # Some catalyst variables...
202 $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
204 # Default values for RC flags
205 $collectedRcFlags = [];
206 foreach ( $recentChangesFlags as $key => $value ) {
207 $flagGrouping = ( $recentChangesFlags[$key]['grouping'] ??
'any' );
208 switch ( $flagGrouping ) {
210 $collectedRcFlags[$key] = true;
213 $collectedRcFlags[$key] = false;
216 throw new DomainException( "Unknown grouping type \"{$flagGrouping}\"" );
219 foreach ( $block as $rcObj ) {
220 // If all log actions to this page were hidden, then don't
221 // give the name of the affected page for this block!
222 if ( !$this->isDeleted( $rcObj, LogPage
::DELETED_ACTION
) ) {
225 $u = $rcObj->userlink
;
226 if ( !isset( $userlinks[$u] ) ) {
229 if ( $rcObj->mAttribs
['rc_type'] != RC_LOG
) {
232 # Get the latest entry with a page_id and oldid
233 # since logs may not have these.
234 if ( !$curId && $rcObj->mAttribs
['rc_cur_id'] ) {
235 $curId = $rcObj->mAttribs
['rc_cur_id'];
241 # Sort the list and convert to text
242 krsort( $userlinks );
245 foreach ( $userlinks as $userlink => $count ) {
247 $text .= $this->getLanguage()->getDirMark();
249 $formattedCount = $this->msg( 'ntimes' )->numParams( $count )->escaped();
250 $text .= ' ' . $this->msg( 'parentheses' )->rawParams( $formattedCount )->escaped();
252 array_push( $users, $text );
257 $revDeletedMsg = false;
259 $revDeletedMsg = $this->msg( 'rev-deleted-event' )->escaped();
260 } elseif ( $allLogs ) {
261 $articleLink = $this->maybeWatchedLink( $block[0]->link
, $block[0]->watched
);
263 $articleLink = $this->getArticleLink( $block[0], $block[0]->unpatrolled
, $block[0]->watched
);
266 $queryParams['curid'] = $curId;
271 foreach ( $block as $i => $rcObj ) {
272 $line = $this->getLineData( $block, $rcObj, $queryParams );
274 // completely ignore this RC entry if we don't want to render it
280 foreach ( $line['recentChangesFlagsRaw'] as $key => $value ) {
281 $flagGrouping = ( $recentChangesFlags[$key]['grouping'] ??
'any' );
282 switch ( $flagGrouping ) {
285 $collectedRcFlags[$key] = false;
290 $collectedRcFlags[$key] = true;
294 throw new DomainException( "Unknown grouping type \"{$flagGrouping}\"" );
298 // Roll up filter-based CSS classes
299 $filterClasses = array_merge( $filterClasses, $this->getHTMLClassesForFilters( $rcObj ) );
300 // Add classes for change tags separately, getHTMLClassesForFilters() doesn't add them
301 $this->getTags( $rcObj, $filterClasses );
302 $filterClasses = array_unique( $filterClasses );
307 // Further down are some assumptions that $block is a 0-indexed array
308 // with (count-1) as last key. Let's make sure it is.
309 $block = array_values( $block );
310 $filterClasses = array_values( $filterClasses );
312 if ( empty( $block ) ||
!$lines ) {
313 // if we can't show anything, don't display this block altogether
317 $logText = $this->getLogText( $block, $queryParams, $allLogs,
318 $collectedRcFlags['newpage'], $namehidden
321 # Character difference (does not apply if only log items)
322 $charDifference = false;
323 if ( $RCShowChangedSize && !$allLogs ) {
325 $first = count( $block ) - 1;
326 # Some events (like logs and category changes) have an "empty" size, so we need to skip those...
327 while ( $last < $first && $block[$last]->mAttribs
['rc_new_len'] === null ) {
330 while ( $last < $first && $block[$first]->mAttribs
['rc_old_len'] === null ) {
334 $charDifference = $this->formatCharacterDifference( $block[$first], $block[$last] ) ?
: false;
337 $numberofWatchingusers = $this->numberofWatchingusers( $block[0]->numberofWatchingusers
);
338 $usersList = $this->msg( 'brackets' )->rawParams(
339 implode( $this->message
['semicolon-separator'], $users )
343 if ( is_callable( $this->changeLinePrefixer
) ) {
344 $prefix = call_user_func( $this->changeLinePrefixer
, $block[0], $this, true );
348 'articleLink' => $articleLink,
349 'charDifference' => $charDifference,
350 'collectedRcFlags' => $this->recentChangesFlags( $collectedRcFlags ),
351 'filterClasses' => $filterClasses,
352 'languageDirMark' => $this->getLanguage()->getDirMark(),
354 'logText' => $logText,
355 'numberofWatchingusers' => $numberofWatchingusers,
357 'rev-deleted-event' => $revDeletedMsg,
358 'tableClasses' => $tableClasses,
359 'timestamp' => $block[0]->timestamp
,
360 'fullTimestamp' => $block[0]->getAttribute( 'rc_timestamp' ),
361 'users' => $usersList,
364 $this->rcCacheIndex++
;
366 return $this->templateParser
->processTemplate(
367 'EnhancedChangesListGroup',
373 * @param RCCacheEntry[] $block
374 * @param RCCacheEntry $rcObj
375 * @param array $queryParams
379 * @throws MWException
381 protected function getLineData( array $block, RCCacheEntry
$rcObj, array $queryParams = [] ) {
382 $RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
384 $type = $rcObj->mAttribs
['rc_type'];
386 $lineParams = [ 'targetTitle' => $rcObj->getTitle() ];
388 $classes = [ 'mw-enhanced-rc' ];
390 && $rcObj->mAttribs
['rc_timestamp'] >= $rcObj->watched
392 $classes[] = 'mw-enhanced-watched';
394 $classes = array_merge( $classes, $this->getHTMLClasses( $rcObj, $rcObj->watched
) );
396 $separator = ' <span class="mw-changeslist-separator">. .</span> ';
398 $data['recentChangesFlags'] = [
399 'newpage' => $type == RC_NEW
,
400 'minor' => $rcObj->mAttribs
['rc_minor'],
401 'unpatrolled' => $rcObj->unpatrolled
,
402 'bot' => $rcObj->mAttribs
['rc_bot'],
405 $params = $queryParams;
407 if ( $rcObj->mAttribs
['rc_this_oldid'] != 0 ) {
408 $params['oldid'] = $rcObj->mAttribs
['rc_this_oldid'];
412 if ( $type == RC_LOG
) {
413 $link = htmlspecialchars( $rcObj->timestamp
);
415 } elseif ( !ChangesList
::userCan( $rcObj, Revision
::DELETED_TEXT
, $this->getUser() ) ) {
416 $link = Html
::element( 'span', [ 'class' => 'history-deleted' ], $rcObj->timestamp
);
418 $link = $this->linkRenderer
->makeKnownLink(
424 if ( $this->isDeleted( $rcObj, Revision
::DELETED_TEXT
) ) {
425 $link = '<span class="history-deleted">' . $link . '</span> ';
428 $data['timestampLink'] = $link;
430 $currentAndLastLinks = '';
431 if ( !$type == RC_LOG ||
$type == RC_NEW
) {
432 $currentAndLastLinks .= ' ' . $this->msg( 'parentheses' )->rawParams(
434 $this->message
['pipe-separator'] .
438 $data['currentAndLastLinks'] = $currentAndLastLinks;
439 $data['separatorAfterCurrentAndLastLinks'] = $separator;
442 if ( $RCShowChangedSize ) {
443 $cd = $this->formatCharacterDifference( $rcObj );
445 $data['characterDiff'] = $cd;
446 $data['separatorAfterCharacterDiff'] = $separator;
450 if ( $rcObj->mAttribs
['rc_type'] == RC_LOG
) {
451 $data['logEntry'] = $this->insertLogEntry( $rcObj );
452 } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
453 $data['comment'] = $this->insertComment( $rcObj );
456 $data['userLink'] = $rcObj->userlink
;
457 $data['userTalkLink'] = $rcObj->usertalklink
;
458 $data['comment'] = $this->insertComment( $rcObj );
462 $data['rollback'] = $this->getRollback( $rcObj );
465 $data['tags'] = $this->getTags( $rcObj, $classes );
467 $attribs = $this->getDataAttributes( $rcObj );
469 // give the hook a chance to modify the data
470 $success = Hooks
::run( 'EnhancedChangesListModifyLineData',
471 [ $this, &$data, $block, $rcObj, &$classes, &$attribs ] );
473 // skip entry if hook aborted it
476 $attribs = array_filter( $attribs,
477 [ Sanitizer
::class, 'isReservedDataAttribute' ],
481 $lineParams['recentChangesFlagsRaw'] = [];
482 if ( isset( $data['recentChangesFlags'] ) ) {
483 $lineParams['recentChangesFlags'] = $this->recentChangesFlags( $data['recentChangesFlags'] );
484 # FIXME: This is used by logic, don't return it in the template params.
485 $lineParams['recentChangesFlagsRaw'] = $data['recentChangesFlags'];
486 unset( $data['recentChangesFlags'] );
489 if ( isset( $data['timestampLink'] ) ) {
490 $lineParams['timestampLink'] = $data['timestampLink'];
491 unset( $data['timestampLink'] );
494 $lineParams['classes'] = array_values( $classes );
495 $lineParams['attribs'] = Html
::expandAttributes( $attribs );
497 // everything else: makes it easier for extensions to add or remove data
498 $lineParams['data'] = array_values( $data );
504 * Generates amount of changes (linking to diff ) & link to history.
506 * @param array $block
507 * @param array $queryParams
508 * @param bool $allLogs
510 * @param bool $namehidden
513 protected function getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ) {
514 if ( empty( $block ) ) {
519 static $nchanges = [];
520 static $sinceLastVisitMsg = [];
522 $n = count( $block );
523 if ( !isset( $nchanges[$n] ) ) {
524 $nchanges[$n] = $this->msg( 'nchanges' )->numParams( $n )->escaped();
528 $unvisitedOldid = null;
529 /** @var RCCacheEntry $rcObj */
530 foreach ( $block as $rcObj ) {
531 // Same logic as below inside main foreach
532 if ( $rcObj->watched
&& $rcObj->mAttribs
['rc_timestamp'] >= $rcObj->watched
) {
534 $unvisitedOldid = $rcObj->mAttribs
['rc_last_oldid'];
537 if ( !isset( $sinceLastVisitMsg[$sinceLast] ) ) {
538 $sinceLastVisitMsg[$sinceLast] =
539 $this->msg( 'enhancedrc-since-last-visit' )->numParams( $sinceLast )->escaped();
542 $currentRevision = 0;
543 foreach ( $block as $rcObj ) {
544 if ( !$currentRevision ) {
545 $currentRevision = $rcObj->mAttribs
['rc_this_oldid'];
551 /** @var RecentChange $block0 */
553 $last = $block[count( $block ) - 1];
555 if ( !ChangesList
::userCan( $rcObj, Revision
::DELETED_TEXT
, $this->getUser() ) ||
557 $rcObj->mAttribs
['rc_type'] == RC_CATEGORIZE
559 $links['total-changes'] = $nchanges[$n];
561 $links['total-changes'] = $this->linkRenderer
->makeKnownLink(
563 new HtmlArmor( $nchanges[$n] ),
564 [ 'class' => 'mw-changeslist-groupdiff' ],
566 'diff' => $currentRevision,
567 'oldid' => $last->mAttribs
['rc_last_oldid'],
570 if ( $sinceLast > 0 && $sinceLast < $n ) {
571 $links['total-changes-since-last'] = $this->linkRenderer
->makeKnownLink(
573 new HtmlArmor( $sinceLastVisitMsg[$sinceLast] ),
574 [ 'class' => 'mw-changeslist-groupdiff' ],
576 'diff' => $currentRevision,
577 'oldid' => $unvisitedOldid,
585 if ( $allLogs ||
$rcObj->mAttribs
['rc_type'] == RC_CATEGORIZE
) {
586 // don't show history link for logs
587 } elseif ( $namehidden ||
!$block0->getTitle()->exists() ) {
588 $links['history'] = $this->message
['enhancedrc-history'];
590 $params = $queryParams;
591 $params['action'] = 'history';
593 $links['history'] = $this->linkRenderer
->makeKnownLink(
595 new HtmlArmor( $this->message
['enhancedrc-history'] ),
596 [ 'class' => 'mw-changeslist-history' ],
601 # Allow others to alter, remove or add to these links
602 Hooks
::run( 'EnhancedChangesList::getLogText',
603 [ $this, &$links, $block ] );
609 $logtext = implode( $this->message
['pipe-separator'], $links );
610 $logtext = $this->msg( 'parentheses' )->rawParams( $logtext )->escaped();
611 return ' ' . $logtext;
615 * Enhanced RC ungrouped line.
617 * @param RecentChange|RCCacheEntry $rcObj
618 * @return string A HTML formatted line (generated using $r)
620 protected function recentChangesBlockLine( $rcObj ) {
623 $query['curid'] = $rcObj->mAttribs
['rc_cur_id'];
625 $type = $rcObj->mAttribs
['rc_type'];
626 $logType = $rcObj->mAttribs
['rc_log_type'];
627 $classes = $this->getHTMLClasses( $rcObj, $rcObj->watched
);
628 $classes[] = 'mw-enhanced-rc';
632 $classes[] = 'mw-changeslist-log';
633 $classes[] = Sanitizer
::escapeClass( 'mw-changeslist-log-' . $logType );
635 $classes[] = 'mw-changeslist-edit';
636 $classes[] = Sanitizer
::escapeClass( 'mw-changeslist-ns' .
637 $rcObj->mAttribs
['rc_namespace'] . '-' . $rcObj->mAttribs
['rc_title'] );
641 $data['recentChangesFlags'] = [
642 'newpage' => $type == RC_NEW
,
643 'minor' => $rcObj->mAttribs
['rc_minor'],
644 'unpatrolled' => $rcObj->unpatrolled
,
645 'bot' => $rcObj->mAttribs
['rc_bot'],
647 // timestamp is not really a link here, but is called timestampLink
648 // for consistency with EnhancedChangesListModifyLineData
649 $data['timestampLink'] = htmlspecialchars( $rcObj->timestamp
);
651 # Article or log link
653 $logPage = new LogPage( $logType );
654 $logTitle = SpecialPage
::getTitleFor( 'Log', $logType );
655 $logName = $logPage->getName()->text();
656 $data['logLink'] = $this->msg( 'parentheses' )
658 $this->linkRenderer
->makeKnownLink( $logTitle, $logName )
661 $data['articleLink'] = $this->getArticleLink( $rcObj, $rcObj->unpatrolled
, $rcObj->watched
);
664 # Diff and hist links
665 if ( $type != RC_LOG
&& $type != RC_CATEGORIZE
) {
666 $query['action'] = 'history';
667 $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
669 $data['separatorAfterLinks'] = ' <span class="mw-changeslist-separator">. .</span> ';
672 if ( $this->getConfig()->get( 'RCShowChangedSize' ) ) {
673 $cd = $this->formatCharacterDifference( $rcObj );
675 $data['characterDiff'] = $cd;
676 $data['separatorAftercharacterDiff'] = ' <span class="mw-changeslist-separator">. .</span> ';
680 if ( $type == RC_LOG
) {
681 $data['logEntry'] = $this->insertLogEntry( $rcObj );
682 } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
683 $data['comment'] = $this->insertComment( $rcObj );
685 $data['userLink'] = $rcObj->userlink
;
686 $data['userTalkLink'] = $rcObj->usertalklink
;
687 $data['comment'] = $this->insertComment( $rcObj );
688 if ( $type == RC_CATEGORIZE
) {
689 $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
691 $data['rollback'] = $this->getRollback( $rcObj );
695 $data['tags'] = $this->getTags( $rcObj, $classes );
697 # Show how many people are watching this if enabled
698 $data['watchingUsers'] = $this->numberofWatchingusers( $rcObj->numberofWatchingusers
);
700 $data['attribs'] = array_merge( $this->getDataAttributes( $rcObj ), [ 'class' => $classes ] );
702 // give the hook a chance to modify the data
703 $success = Hooks
::run( 'EnhancedChangesListModifyBlockLineData',
704 [ $this, &$data, $rcObj ] );
706 // skip entry if hook aborted it
709 $attribs = $data['attribs'];
710 unset( $data['attribs'] );
711 $attribs = array_filter( $attribs, function ( $key ) {
712 return $key === 'class' || Sanitizer
::isReservedDataAttribute( $key );
713 }, ARRAY_FILTER_USE_KEY
);
716 if ( is_callable( $this->changeLinePrefixer
) ) {
717 $prefix = call_user_func( $this->changeLinePrefixer
, $rcObj, $this, false );
720 $line = Html
::openElement( 'table', $attribs ) . Html
::openElement( 'tr' );
722 $line .= Html
::rawElement( 'td', [],
723 $this->getHighlightsContainerDiv()
726 $line .= Html
::rawElement( 'td', [], '<span class="mw-enhancedchanges-arrow-space"></span>' );
727 $line .= Html
::rawElement( 'td', [ 'class' => 'mw-changeslist-line-prefix' ], $prefix );
728 $line .= '<td class="mw-enhanced-rc" colspan="2">';
730 if ( isset( $data['recentChangesFlags'] ) ) {
731 $line .= $this->recentChangesFlags( $data['recentChangesFlags'] );
732 unset( $data['recentChangesFlags'] );
735 if ( isset( $data['timestampLink'] ) ) {
736 $line .= "\u{00A0}" . $data['timestampLink'];
737 unset( $data['timestampLink'] );
739 $line .= "\u{00A0}</td>";
740 $line .= Html
::openElement( 'td', [
741 'class' => 'mw-changeslist-line-inner',
742 // Used for reliable determination of the affiliated page
743 'data-target-page' => $rcObj->getTitle(),
746 // everything else: makes it easier for extensions to add or remove data
747 $line .= implode( '', $data );
749 $line .= "</td></tr></table>\n";
755 * Returns value to be used in 'historyLink' element of $data param in
756 * EnhancedChangesListModifyBlockLineData hook.
760 * @param RCCacheEntry $rc
761 * @param array $query array of key/value pairs to append as a query string
762 * @return string HTML
764 public function getDiffHistLinks( RCCacheEntry
$rc, array $query ) {
765 $pageTitle = $rc->getTitle();
766 if ( $rc->getAttribute( 'rc_type' ) == RC_CATEGORIZE
) {
767 // For categorizations we must swap the category title with the page title!
768 $pageTitle = Title
::newFromID( $rc->getAttribute( 'rc_cur_id' ) );
770 // The page has been deleted, but the RC entry
771 // deletion job has not run yet. Just skip.
776 $retVal = ' ' . $this->msg( 'parentheses' )
777 ->rawParams( $rc->difflink
. $this->message
['pipe-separator']
778 . $this->linkRenderer
->makeKnownLink(
780 new HtmlArmor( $this->message
['hist'] ),
781 [ 'class' => 'mw-changeslist-history' ],
788 * If enhanced RC is in use, this function takes the previously cached
789 * RC lines, arranges them, and outputs the HTML
793 protected function recentChangesBlock() {
794 if ( count( $this->rc_cache
) == 0 ) {
799 foreach ( $this->rc_cache
as $block ) {
800 if ( count( $block ) < 2 ) {
801 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
803 $blockOut .= $this->recentChangesBlockGroup( $block );
807 if ( $blockOut === '' ) {
810 // $this->lastdate is kept up to date by recentChangesLine()
811 return Xml
::element( 'h4', null, $this->lastdate
) . "\n<div>" . $blockOut . '</div>';
815 * Returns text for the end of RC
816 * If enhanced RC is in use, returns pretty much all the text
819 public function endRecentChangesList() {
820 return $this->recentChangesBlock() . '</div>';